<template>
	<!-- 驳回 输入驳回理由 -->
	<u-popup v-model="getPopupModel" mode="center" border-radius="12">
		<view class="tips">
			<view class="tips-title">
				取消原因
			</view>
			<view class="tips-info">
				<u-input placeholder="请输入驳回原因" v-model="rejection" type="textarea" border />
			</view>
			<view>
				<view class="u-flex">
					<u-button class="u-flex-1 u-margin-right-10" shape="circle" @click="handleCancel">取消</u-button>
					<u-button :custom-style="{
					'background':'#0FBD7F',
					'color':'#fff'
				}" class="u-flex-1" shape="circle" @click="handleSubmit">确认</u-button>
				</view>
			</view>
		</view>
	</u-popup>
</template>

<script>
	export default {
		model: {
			value: 'value',
			event: 'input'
		},
		props: {
			value: {
				type: Boolean,                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                
			}
		},
		computed: {
			getPopupModel: {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
				get() {
					return this.value 
				},
				set(val) {
					if (!val) {
						this.rejection = ""
						this.$emit('input', false)
					}
				}
			}
		},
		data() {
			return {
				rejection: ''
			}
		},
		methods: {
			handleCancel() {
				this.getPopupModel = false
			},
			handleSubmit() {
				if(!this.rejection){
					this.$toast('请输入驳回原因',this)
					return
				}
				this.$emit('submit', this.rejection)
				this.getPopupModel = false
			}
		}
	}
</script>

<style scoped lang="less">
	.tips {
		padding: 20px;
		width: 295px;
		min-height: 187px;
		display: flex;
		flex-flow: column;
		justify-content: space-between;

		.tips-title {
			color: #202020;
			font-weight: bold;
			font-size: 16px;
			text-align: center;
		}

		.tips-info {
			color: #666666;
			font-size: 14px;
			text-align: center;
			padding: 15px 0;
		}
	}
</style>